_NOWPAGE = 1;
$(function () {
    // 获取列表信息
    var cid = Common.fn.getUrlParam('cid');
    // cid存在

//插入定位box
    var templ = '<span class="box location-box"></span>'
    $(templ).appendTo($("#flow-list"));
//上滑事件触发瀑布流
    $("html, body").scrollTop(1);
    var index = 1;
    var pageNum = 10;
    $("#flow-list").waterfall({
        itemClass: ".box",
        minColCount: 2,
        spacingHeight: 10,
        isFadeIn: true,
        resizeable: true,
        ajaxCallback: function (success, end) {

            findAllGoodsItem(pageNum, index)
            console.log("调用了一次")
            console.log(index)
            console.log(pageNum)
            success();
            index++;
            end();
            $(".location-box").remove();
        }
    });
})

function findAllGoodsItem(pageSize, page, cid) {
    var result = Model.goods.getProxyItem({
        pageSize: pageSize,
        page: page,
    });
    if (result.goods.length == 0) {
        $('#flow-list').append('<p style="position: absolute;z-index: 9999; bottom: 4.5rem;left: 43%;color: #666666;">没有更多数据了</p>');
    }
    for (var i = 0; i < result.goods.length; i++) {
        var item = '<a class="box" href="product_release_detail.html?id=' + result.goods[i].id + '"><img src="' + ((result.goods[i].goodsImg.length > 0) ? result.goods[i].goodsImg[0].image : '') + '" /><p class="flow-list-name">' + result.goods[i].content + '</p>' +
            '<p class="flow-list-price">￥ ' + result.goods[i].price + '</p></a>';
        $('#flow-list').append(item);
    }

}
